package com.usian.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.usian.pojo.Commodity;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface CommodityMapper extends BaseMapper<Commodity> {
    @Select("select * from commodity where cstart=1")
    List<Commodity> findAll();

    @Select("select * from commodity where cstart>3")
    List<Commodity> findAllAnd();

    @Select("select * from commodity where cid=#{cid}")
    Commodity findById(@Param("cid") Integer cid);

    @Select("select * from commodity where cstart=2")
    List<Commodity> querystatus();

    @Select("select * from commodity where cname=#{cname} and cstart!=2")
    String chaxun(@Param("cname") String cname);

    @Update("update commodity set cstart=4 where cid=#{cid}")
    void updateByCStart(@Param("cid") Integer cid);

    @Update("update commodity set cstart=5 where cid=#{cid}")
    void updateByCStartTo(@Param("cid") Integer cid);

    @Update("update commodity set cstart=2 where cid=#{cid} ")
    void check(@Param("cid") Integer cid);

    @Update("update commodity set cstart=6 where cid=#{cid} ")
    void shangjia(@Param("cid") Integer cid);

    @Update("update commodity set cstart=7 where cid=#{cid} ")
    void xiajia(@Param("cid") Integer cid);
}
